﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Demo
{
    class Student
    {
        //属性、特征，数据，字段
        private string name; 
        private int age;
        private string sex;

        //属性
        public string Name{
            get { return this.name; }
            set {
                //this.name = value;
                if (name.Equals("毛泽东"))
                {
                    Console.WriteLine("输入非法姓名");
                    this.name = "";
                }
            }
        }

        public string Sex
        {
            get { return this.sex;}
            set { this.sex = value; }
        }

        public int Age
        {

            get { return this.age; }
            set { this.age = value; }
        }

        public void SetAge(int value) 
        {
            this.age = value;
        }

        //行为
        public void Introduce()
        {
            Console.WriteLine("我叫{0}，我的性别是{1}，我今年{2}岁",this.name,this.sex,this.age);
        }
    }

}
